/*
 * Copyright (c) 2015-2018 Sfkj Science And Technology Co.,Ltd.
 * All Rights Reserved.
 * This software is the confidential and proprietary information of
 * Sfkj Science And Technology Co.,Ltd.
 * ("Confidential Information").You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Sfkj.
 */
package com.sfkj.walk.mongo;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.time.LocalDateTime;

@Getter
@Setter
@EqualsAndHashCode(of = "id")
@Document
public abstract class AbstractDocument implements java.io.Serializable {
    /**
     *
     */
    private static final long serialVersionUID = 1469906980076321341L;

    /**
     * ID
     */
    @Id
    private String id;

    /**
     * Created date
     */
    private LocalDateTime createdDate;

    /**
     * Last update
     */
    private LocalDateTime lastUpdate;

    public AbstractDocument() {

    }

    public AbstractDocument(AbstractDocument doc) {
        id = doc.id;
        createdDate = doc.createdDate;
        lastUpdate = doc.lastUpdate;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this)
                .append("id", id)
                .append("createdDate", createdDate)
                .append("lastUpdate", lastUpdate)
                .toString();
    }
}
